//
// Created by WenDaoJiang on 2017/5/9.
// Copyright (c) 2017 文道江. All rights reserved.
//

#import "HybridAgoraAction.h"

@implementation HybridAgoraAction

// Agora/call

- (void)callUser:(id)params {
    if (params[@"toUid"] == nil) {
        [self callback:NO data:@"call fail"];
    } else {
        [HybridEventBus.defaultEventBus postData:params Tag:@"local_call_user"];
    }
}

- (void)login:(id)params {
    NSDictionary *loginInfo = @{
            @"uid": params[@"uid"],
            @"userType": params[@"userType"],
            @"auth": params[@"auth"]
    };
    [KVStorage setKey:@"agora_signal_login_info" Value:loginInfo];
    [HybridEventBus.defaultEventBus postData:loginInfo Tag:@"agora_signal_login"];
}

- (void)logout:(id)params {
    [KVStorage setKey:@"agora_signal_login_info" Value:[NSNull null]];
    [HybridEventBus.defaultEventBus postData:@{} Tag:@"agora_signal_logout"];
}


@end